//
//  BindMobileSucceedViewController.m
//  PlayBall
//
//  Created by Edward Zhang on 12-5-8.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import "JddBindMobileSucceedViewController.h"
#import "JddViewControllerManager.h"

@interface JddBindMobileSucceedViewController ()

@end

@implementation JddBindMobileSucceedViewController

@synthesize mobileLabel;

SHARED_VIEW_CONTROLLER_IMPLEMENT(JddBindMobileSucceedViewController);

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

-(IBAction)reBindMobile:(id)sender{
    [[JddViewControllerManager sharedInstance] pushViewControllerWithIndex:CONTROLLER_BIND_MOBILE 
                                                         fromController:self
                                                             withObject:nil 
                                                            withObject2:nil];
}


- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.

        UILabel *customLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 40, 30)];
        customLab.backgroundColor = [UIColor clearColor];
        [customLab setText:PAGE_BIND_MOBILE];
        customLab.textAlignment = NSTextAlignmentCenter;
        [customLab setTextColor:[UIColor whiteColor]];
        customLab.font = [UIFont systemFontOfSize:19];
        self.navigationItem.titleView = customLab;
        
//        //self.navigationItem.hidesBackButton = YES;

}

-(void)QueryUserInfoOperationResult:(NSData *)result{
    if (result) {
        if ([JddDataParser parseUserInfoResult:result]) {
            self.mobileLabel.text = [JddUserProfile sharedInstance].bindMobile;
        }
    }
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [MobClick beginLogPageView:@"bindMobileSucceed"];
	[MobClick event:@"UserCenter-bindmobileSucceed"];

    JddQueryUserInfoOperation *operation = [[JddQueryUserInfoOperation alloc] init];
    operation.delegate = self;
    [[JddGlobalParameter sharedInstance].operationQueue addOperation:operation];
}
- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    [MobClick endLogPageView:@"bindMobileSucceed"];
}
- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

@end
